﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using JM.JCY.BusinessEntity.DSJCYD94;
using JM.JCY.Proxy;
using System.Data;

namespace JM.JCY.SharePointComponent.LawArchives.SuperviseDetails
{
    public partial class SuperviseDetailsUserControl : UserControl
    {
        T_AJBSGXDataSet.T_AJBSGXDataTable AJBSGXData;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string N_BH = Request.QueryString["N_BH"].ToString();
                this.lbBH.Text = N_BH;
                var JDB = GetJDBDataByBH(Convert.ToDecimal(N_BH));
                AJBSGXData = GetAJBSGXDataByBH(Convert.ToDecimal(N_BH));
                lbBATS.Text = AJBSGXData.Count > 0 ? AJBSGXData[0].N_BATS.ToString() : "0";
                BindData(JDB);
            }
        }
        public void BindData(T_JDBDataSet.T_JDBSearchDataTable jDBDT)
        {
            var row = jDBDT[0];
            this.lbID.Text = string.IsNullOrEmpty(row.C_AH) ? string.Empty : row.C_AH.ToString();
            this.LabelGetDate.Text = row.IsD_JDBSJNull() ? string.Empty : row.D_JDBSJ.ToString("yyyy年MM月dd日");
            this.lbPerson.Text = string.IsNullOrEmpty(row.C_XM) ? string.Empty : row.C_XM;
            lbHandleDate.Text = row.IsD_HFRQNull() ? string.Empty : row.D_HFRQ.ToString("yyyy年MM月dd日");
            this.lbBSSR.Text = string.IsNullOrEmpty(row.C_BSSR) ? string.Empty : row.C_BSSR.ToString();
           
        }
        public T_JDBDataSet.T_JDBSearchDataTable GetJDBDataByBH(decimal BH)
        {
            using (var proxy = new DSJCYD94Proxy())
            {
                return proxy.GetJDBDataByBH(BH);
            }
        }

        public T_AJBSGXDataSet.T_AJBSGXDataTable GetAJBSGXDataByBH(decimal BH)
        {
            using (var proxy = new DSJCYD94Proxy())
            {
                return proxy.GetAJBSGXDataByBH(BH);
            }
        }

       
    }
}
